/**
 * Created by cy on 2017/8/22.
 */
import React, { Component } from 'react';
import { StatusBar, AsyncStorage, Platform, NativeAppEventEmitter,DeviceEventEmitter,Image,View} from 'react-native';
import { StackNavigator, TabNavigator, TabBarBottom, NavigationActions} from 'react-navigation';
import Home from './page/home/home';
import Order from './page/order/orderList';
import User from './page/user/user';
import Brand from './page/brand/brand'
import Ramble from './page/ramble/ramble'


const Tab = TabNavigator(
    {
        Task: {
            screen: Home,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '首页',
                tabBarIcon: ({ tintColor }) => (
                <Image
                    source={require('./img/tabbar/pfb_tabbar_homepage.png')}
                    style={[{width: 25, height: 25,}, {tintColor: tintColor}]}
                />
                )
            }),
        },
        Brand: {
            screen: Brand,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '品牌',
                tabBarIcon: ({tintColor }) => (
                    <Image
                        source={require('./img/tabbar/pfb_tabbar_order.png')}
                        style={[{width: 25, height: 25,}, {tintColor: tintColor}]}
                    />
                )
            }),
        },
        Ramble: {
            screen: Ramble,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '逛逛',
                tabBarIcon: ({tintColor }) => (
                <Image
                    source={require('./img/tabbar/pfb_tabbar_discover.png')}
                    style={[{width: 25, height: 25,}, {tintColor: tintColor}]}
                />
                )
            }),
        },

        User: {
            screen: User,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '我的',
                tabBarIcon: ({ tintColor }) => (
                <Image
                    source={require('./img/tabbar/pfb_tabbar_mine.png')}
                    style={[{width: 25, height: 25,}, {tintColor: tintColor}]}
                />
                )
            }),
        },
    },
    {
        tabBarComponent: TabBarBottom,
        tabBarPosition: 'bottom',
        swipeEnabled: false,
        animationEnabled: false,
        lazy: true,
        backBehavior:'none',
        tabBarOptions: {
            activeTintColor: '#87ace9',
            inactiveTintColor: '#979797',
            style: { backgroundColor: '#ffffff' },
        },
    }

);

const Navigator = StackNavigator(
    {
        Tab: { screen: Tab },

    },

    {
        navigationOptions: {
            headerBackTitle: null,
            showIcon: true,
            headerStyle:{
                //导航栏背景颜色
                backgroundColor:'#fda1a0',
                shadowOpacity:0,
                elevation: 0
            },
            //导航栏返回按钮颜色
            headerTintColor: '#fff',
            //安卓导航栏标题居中
            // headerTitleStyle: {
            //     alignSelf:'center',
            // },
        },
    }
);


class index extends Component {

    render(){
        return (<Navigator/>)
    }
}
export default index;